const intervalId = setInterval(() => {
    console.log("This runs every 2 seconds.");
  }, 2000);
  
  // Clear the interval after 10 seconds
  setTimeout(() => {
    clearInterval(intervalId);
    console.log("Interval cleared.");
  }, 10000);